#include "yaml-cpp/yaml.h"
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
	YAML::Node config = YAML::LoadFile("ngrok.cfg");

	if (config["server_addr"])
	{
		std::cout << "server_addr" << config["server_addr"].as<std::string>();
	}

	YAML::Node tunnels = config["tunnels"];


	for (YAML::const_iterator it = tunnels.begin(); it != tunnels.end(); ++it)
	{
		std::string key = it->first.as<std::string>();
		YAML::Node subnode = tunnels[key];
		if (subnode["remote_port"])
		{
			subnode["remote_port"] = 8888;
		}
	}

	ofstream out("ngrok.cfg");
	out << config;
	getchar();
	return 1;
}

